package com.collection;

import java.util.ArrayList;
@SuppressWarnings({"all"})
public class HomeWork_1 {
    public static void main(String[] args) {
        ArrayList array=new ArrayList();
        array.add(new Car("BAM",300000));
        array.add(new Car("SU7",200000));
        array.add(new Car("奔驰E300",450000));
        array.add(new Car("仰望U8",500000));
        array.add(new Car("极氪009",700000));
        array.remove(1);
        for( Object car:array){
            System.out.println(car);
        }

    }
}

class Car{
    private String name;
    private double price;

    public Car(String name, double price) {
        this.name = name;
        this.price = price;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    @Override
    public String toString() {
        return "Car{" +
                "name='" + name + '\'' +
                ", price=" + price +
                '}';
    }
}